package com.example.ice.coursetable.wbstrategy;

import android.annotation.SuppressLint;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureRequest;
import android.os.Handler;

import com.example.ice.coursetable.flashstrategy.FlashStrategy;


public class AutoWBStrategy implements FlashStrategy {

    @SuppressLint("NewApi")
    @Override
    public void setCaptureRequest(CaptureRequest.Builder requestBuilder, CameraCaptureSession cameraCaptureSession, Handler handler) {
        requestBuilder.set(CaptureRequest.CONTROL_AWB_MODE, CameraMetadata.CONTROL_AWB_MODE_AUTO);
        try {
            cameraCaptureSession.setRepeatingRequest(requestBuilder.build(),null,handler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
}
